<template>
  <div class="order-msg flex">
    <i class="iconfont order-img icon-icon_list1">&#xe61f;</i>
    <div class="order-content flex flex-horizontal-between">
      <ul class="flex flex-wrap flex-horizontal-between">
        <li v-for="(item,index) in msgList" :key="index"
          :class="['flex','flex-vertical-center',{'width-100':item.key=='orderCode'}]">
          <p>
            <span v-show="item.key!='counselorName'">{{orderStatusName}}</span>{{item.name}}:
          </p>
          <p>
            {{detailMsg[item.key]}}
            <span v-show="item.key=='counselorName'">({{detailMsg['submitWorkNo']}})</span>
          </p>
          <p v-if="item.key=='orderCode'" class="check_order" @click="toOrder">
            查看{{orderStatusName}}单
          </p>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
  export default {
    props: ['detailMsg', 'orderStatusName', 'isCompanyBase'],
    data() {
      return {
        msgList: [{
          name: '单编号',
          key: 'orderCode',
        },
        {
          name: '客户',
          key: 'customerName',
        },
        {
          name: '房源',
          key: 'roomName',
        },
        {
          name: '所属顾问',
          key: 'counselorName',
        },
        {
          name: '日期',
          key: 'createTime',
        }, ],
        baseMsg: {},
      }
    },
    methods: {
      toOrder() {
        if (this.orderStatusName == '认购') {
          console.log(this.isCompanyBase, '&*(')
          if (this.isCompanyBase) {
            this.$router.push({
              name: 'viewSubscriptionDetail',
              query: {
                examineBtn: false,
                orderStatusName: '认购',
                orderNum: this.detailMsg.orderCode, // 单号
                businessId: this.detailMsg.businessId, // 业务id
                buildingId: this.detailMsg.buildingId, // 楼盘ID
                isShowbasePrice: 'basePrice', // 订单是否查看流程按钮
                parentPath: '/flowApproval/riskControl/companyBasePrice'
              },
            })
          } else {
            this.$router.push({
              name: 'subscriptionDetail',
              query: {
                examineBtn: false,
                orderStatusName: '认购',
                orderNum: this.detailMsg.orderCode, // 单号
                businessId: this.detailMsg.businessId, // 业务id
                buildingId: this.detailMsg.buildingId, // 楼盘ID
                isShowbasePrice: 'basePrice', // 订单是否查看流程按钮
              },
            })
          }

        } else if (this.orderStatusName == '签约') {
          if (this.isCompanyBase) {
            this.$router.push({
              name: 'viewContractDetail',
              query: {
                examineBtn: false,
                orderStatusName: '签约',
                orderNum: this.detailMsg.orderCode, // 单号
                businessId: this.detailMsg.businessId, // 业务id
                buildingId: this.detailMsg.buildingId, // 楼盘ID
                isShowbasePrice: 'basePrice', // 订单是否查看流程按钮
                parentPath: '/flowApproval/riskControl/companyBasePrice'
              },
            })
          } else {
            this.$router.push({
              name: 'contractDetail',
              query: {
                examineBtn: false,
                orderStatusName: '签约',
                orderNum: this.detailMsg.orderCode, // 单号
                businessId: this.detailMsg.businessId, // 业务id
                buildingId: this.detailMsg.buildingId, // 楼盘ID
                isShowbasePrice: 'basePrice', // 订单是否查看流程按钮
              },
            })
          }
        }
      }
    },
    created() {
      console.log(this.detailMsg, this.isCompanyBase, '%%%')
      this.baseMsg = {
        ...this.detailMsg
      }
    },
    mounted() {},
  }
</script>
<style lang="scss" scoped>
  .order-msg {
    padding: 10px 40px;
    width: 100%;
    background-color: #f2f2f2;

    .order-content {
      height: 120px;
      width: 100%;
      background-color: #f2f2f2;
      font-size: 18px;
    }

    .order-img {
      margin: 15px 0;
      width: 30px;
      height: 30px;
      color: #0f42a7;
      font-size: 24px;
    }

    .check_order {
      color: #0f42a7;
      cursor: pointer;
      margin-left: 10px
    }
  }
</style>